/**
 *  Copyright Matt Silbernagel 2010
 *  
 *	This file is part of MobilePrinting.
 *
 *	MobilePrinting is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  MobilePrinting is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with MobilePrinting.  If not, see <http://www.gnu.org/licenses/>.
 */

package edu.uc.labs.MobilePrinting.Prefs;

public class Preferences {

	public Preferences(){
		
	}
	
	/**
	 * Setter for startAtLogin
	 * @param setParam string representation of 1 or 0 (true or false)
	 */
	public void setStartAtLogin( String setParam ){
		this.startAtLogin = setParam.equals("0") ? false : true;
	}

	/**
	 * Getter for startAtLogin
	 * @return true if startAtLogin is set
	 */
	public boolean isStartAtLogin() {
		return startAtLogin;
	}
	
	/**
	 * Setter for deleteOnExit
	 * @param setParam string representation of 1 or 0 (true or false)
	 */
	public void setDeleteOnExit( String setParam ) {
		this.deleteOnExit = setParam.equals("0") ? false : true;
	}
	
	/**
	 * Getter for deleteOnExit
	 * @return true if deleteOnExit is set
	 */
	public boolean isDeleteOnExit() {
		return deleteOnExit;
	}
	
	/**
	 * @return the autoUpdate
	 */
	public boolean isAutoUpdate() {
		return autoUpdate;
	}

	/**
	 * @param autoUpdate the autoUpdate to set
	 */
	public void setAutoUpdate( String autoUpdate) {
		this.autoUpdate = autoUpdate.equals("0") ? false : true;
	}

	/**
	 * @return the configServer
	 */
	public String getConfigServer() {
		return configServer;
	}

	/**
	 * @param configServer the configServer to set
	 */
	public void setConfigServer(String configServer) {
		this.configServer = configServer;
	}

	/**
	 * @return the printerName
	 */
	public String getPrinterName() {
		return printerName;
	}

	/**
	 * @param printerName the printerName to set
	 */
	public void setPrinterName(String printerName) {
		this.printerName = printerName;
	}

	/**
	 * @return the logLevel
	 */
	public String getLogLevel() {
		return logLevel;
	}

	/**
	 * @param logLevel the logLevel to set
	 */
	public void setLogLevel(String logLevel) {
		this.logLevel = logLevel;
	}

	public String toString(){

        return ("\n\nStart at Login:  " + booleanToString(startAtLogin) + "\n" +
                        "Delete on Exit:  " + booleanToString(deleteOnExit) + "\n" +
                        "Auto Update:     " + booleanToString(autoUpdate)   + "\n" +
                        "========================\n" +
                        "Configuration Server: " + configServer + "\n" +
                        "Printer Name:         " + printerName  + "\n" +
                        "Log Level:                        " + logLevel         + "\n" );
	}

	private String booleanToString( boolean test ) {
        if(test){
                return "True";
        } else {
                return "False";
        }
	}


	
	
	// Variable Declaration 
	private boolean startAtLogin;
	private boolean deleteOnExit;
	private boolean autoUpdate;
	private String configServer;
	private String printerName;
	private String logLevel;


}
